import { get, post } from "@/service/base";



interface CreateReq {
    name: string,
    description: string,
    version: number,
}

export async function createProj(req: CreateReq) {
    const resp = await post('/proj/create', req);
    const id = await resp.parse<number>();
    return id;
}

export interface TbProj {
    id: number,
    name: string,
    description: string,
    version: number
}

export async function queryProj() {
    const resp = await get('/proj/query');
    const items = await resp.parse<TbProj[]>();
    return items;
}

export async function deleteProj(id: number) {
    await post('/proj/delete', id);
}



